package com.fun_ordering.filter;

import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

//架入spring管理，服务器启动即生效
//@Component
public class WebMvc implements WebMvcConfigurer {
    /**
     * 登录拦截器
     * @param registry
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new LoginInterceptor())
                //放行,让其可以登录
                .excludePathPatterns("/login")
                //、**访问的是整个目录的任意路劲，/*当前的第一级路径
                .addPathPatterns("/**");
    }
}
